package com.virtual.repository.common.queries;

import java.util.Collection;

import com.virtual.repository.common.criteria.Criterion;

/**
 * A general builder for the <code>Query</code> class.
 * @author Zielony
 * @version 1.0
 */
public interface IQueryBuilder {
	
	/**
	 * Adds a new property to be returned by the query.
	 * @param property a new property to be returned by the query.
	 */
	public abstract void addProperty(String property);

	/**
	 * Sets the limit on the number of returned results. <code>null</code> means no limit.
	 * @param limit the limit in question.
	 */
	public abstract void setLimit(Integer limit);

	/**
	 * Adds a sorting rule for the results.
	 * @param property the property using which the results will be sorted.
	 * @param reverse whether the sort should be in ascending or descending order.
	 */
	public abstract void addOrderByRule(String property, boolean reverse);

	/**
	 * Adds a <code>List</code> of criteria.
	 * @param criteria a <code>List</code> of criteria to be added.
	 */
	public abstract void addCriteria(Collection<Criterion> criteria);
	
	/**
	 * Builds the <code>Query</code>.
	 * @return the <code>Query</co 
	 */
	public abstract Query build();
}